
    //自定义滚动条特效，列表中必须要有滚动条且隐藏，滚动条相对于滚动条框绝对定位
    function anyscroll(bigwrap, li, scrdad,scr,fn1,fn2,fn3) {
        //列表框元素，列表项目元素，滚动条框元素，滚动条元素,滚动条拖动执行函数
        scr[0].flag = 0;
        //计算滚动条滑块长度,并设置
        let listwidth = 0;
        li.each(function (i, v) {
            listwidth += $(v).outerWidth(true);
        });
        let scrwidth = scrdad.width() * bigwrap.width() / listwidth;
        scr.width(scrwidth);

        scr.on('mousedown', function (ev) {
            scr[0].flag = 1;
            let downx = ev.pageX;
            let scrleft = parseInt(scr.css("left"));
            $(document).on('mousemove', function (ev) {
                if (scr[0].flag == 1) {
                    let movex = scrleft + ev.pageX - downx;
                    bigwrap.scrollLeft(movex * (listwidth / bigwrap.width()));
                    scr.css({ "left": movex });
                    fn1();
                    //设置黑块移动范围
                    if (parseInt(scr.css("left")) <= 0) {
                        scr.css({ "left": 0 });
                    }
                    if (parseInt(scr.css("left")) >= scrdad.width() - scr.width()) {
                        scr.css({ "left": scrdad.width() - scr.width() });;
                    }
                }
            });
            $(document).on('mouseup', function () {
                scr[0].flag = 0;
                fn2();
            });
        });
        scr.hover(function(){
            fn3();
        },function(){
            fn2();
        });
    }

